package com.dragon.modules.yuegou.service.impl.coupon;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dragon.common.web.PageRequest;
import com.dragon.modules.yuegou.entity.coupon.MerchantCouponGrantEntity;
import com.dragon.modules.yuegou.mapper.coupon.MerchantCouponGrantMapper;
import com.dragon.modules.yuegou.model.coupon.MerchantCouponGrant;
import com.dragon.modules.yuegou.service.coupon.MerchantCouponGrantService;
import com.dragon.modules.yuegou.web.Check;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * 商户优惠券发放（商户发放优惠券给会员） 服务实现
 *
 * @author pbuilder generated
 * @date 2019-02-28 18:30:18
 * @version 2.0
 */
@Service("coupMerchantCouponGrantService")
public class MerchantCouponGrantServiceImpl
		extends ServiceImpl<MerchantCouponGrantMapper, MerchantCouponGrantEntity>
		implements MerchantCouponGrantService {

	@Autowired
	private MerchantCouponGrantMapper merchantCouponGrantMapper;

	@Override
	public IPage<MerchantCouponGrant> grantRecord(PageRequest page, String merchantId) {
		Check.notEmpty(merchantId, "merchantId is required");
		IPage<MerchantCouponGrant> grantIPage = new Page<>(page.getPage(),page.getSize(),page.getCount());
		return merchantCouponGrantMapper.grantRecord(grantIPage,merchantId);
	}

    @Override
    public IPage<MerchantCouponGrant> yshAppGrantRecord(PageRequest page, String merchantId) {
        Check.notEmpty(merchantId, "merchantId is required");
		IPage<MerchantCouponGrant> grantIPage = new Page<>(page.getPage(),page.getSize(),page.getCount());
        return merchantCouponGrantMapper.yshAppgrantRecord(grantIPage,merchantId);
    }
}